import {createRouter, createWebHistory} from 'vue-router'
import LoginRegisterView from "@/views/LoginRegisterView.vue";
import LayoutView from "@/components/LayoutView.vue";
import HomeView from "@/views/home/HomeView.vue";
import ArticleView from "@/views/article/ArticleView.vue";
import SkillListView from "@/views/skill/SkillListView.vue";
import HealthListView from "@/views/health/HealthListView.vue";
import GalleryView from "@/views/gallery/GalleryView.vue";
import GalleryListView from "@/views/gallery/GalleryListView.vue";
import SearchView from "@/views/SearchView.vue";
import AdminHome from "@/views/admin/AdminHome.vue";
import AddArticleView from "@/views/admin/AddArticleView.vue";
import ArticleListView from "@/views/admin/ArticleListView.vue";
import CollectionListView from "@/views/collection/CollectionListView.vue";
import UserCenterView from "@/views/admin/UserCenterView.vue";

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            name: 'main',
            component: LayoutView,
            children: [
                {
                    path: '/',
                    name: 'home',
                    component: HomeView,
                },
                {
                    path: '/article/:id',
                    name: 'article',
                    component: ArticleView,
                },
                {
                    path: '/skill',
                    name: 'skill',
                    component: SkillListView,
                },
                {
                    path: '/health',
                    name: 'health',
                    component: HealthListView
                },
                {
                    path: '/gallery',
                    name: 'gallery',
                    component: GalleryView,
                },
                {
                    path: '/collection/list',
                    name: 'collection-list',
                    component: CollectionListView,
                },
                {
                    path: '/gallery/list/:id/:title',
                    name: 'gallery-list',
                    component: GalleryListView,
                },
                {
                    path: '/search/list/:keyword',
                    name: 'search',
                    component: SearchView,
                }
            ],
        },
        {
            path: '/login',
            name: 'login',
            component: LoginRegisterView,
        },
        {
            path: '/admin',
            name: 'admin',
            component: AdminHome,
            children: [
                {
                    path: '/admin',
                    name: 'article-write',
                    component: AddArticleView,
                },
                {
                    path: '/admin/user/center',
                    name: 'user-center',
                    component: UserCenterView,
                },
                {
                    path: '/admin/article/list',
                    name: 'article-list',
                    component: ArticleListView,
                }
            ],
        }
    ],
})

export default router
